<!DOCTYPE html>
<html>
<head>
    %{--<meta name="layout" content="main"/>
    <g:set var="entityName" value="${message(code: 'estate.label', default: 'estate')}"/>
    <title>押品搜索</title>--}%
</head>

<body class="fixed-navbar fixed-sidebar">

<div class="content animate-panel">
    <div class="row">

            <div class="hpanel hblue">
                    <div class="panel-heading">
                        <div class="panel-tools">
                            <button class="btn btn-primary btn-xs" id="searchData" type="submit" onclick="text()"><i class="fa fa-search"></i>查询</button>
                            <button class="btn btn-warning2 btn-xs" type="button" id="resetBtn">
                                <i class="fa fa-times"></i>重置</button>
                        </div>
                        查询
                    </div>

                    <div class="panel-body seach-group" id="bug1">
        %{--第一行--}%
         <g:form method="POST" action="searchEstate" class="form-horizontal" role="form">
            <div class="row">
                <div class="form-group col-sm-3">
                    <label for="district" class="col-sm-4 control-label">城市</label>
                    <div class="col-sm-8">
                        <g:select class="form-control" name="city" id="city"
                                  from="${com.cindata.City.executeQuery("select distinct e.city as city from  Estate e ")}"
                                  valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                  value="${params?.city}"
                                  noSelection="${["-1": '请选择城市']}"/>
                    </div>
                </div>
                <div class="form-group col-sm-5">
                    <label for="district" class="col-sm-3 control-label">贷款金额范围</label>
                    <div class="col-sm-7 input-group ">
                        <input type="text" class=" form-control " placeholder="请输入下限" maxlength="6"
                               id="loansAmountStart" value="${params?.loansAmountStart}" name="loansAmountStart" />
                        <span class="input-group-addon">至</span>
                        <input type="text" class=" form-control " placeholder="请输入上限" maxlength="6"
                               id="loansAmountEnd" value="${params?.loansAmountEnd}" name="loansAmountEnd" />
                    </div>
                    <div class="col-sm-2 p-t-xss">
                        万元
                    </div>
                </div>
                <div class="form-group col-sm-4">
                    <label class="col-sm-3 control-label" >押品风险</label>
                    <div class="col-sm-9">
                        <g:select class="form-control" name="risk" id="risk"
                                  from="${com.cindata.dimension.RiskDimension.list()}"
                                  valueMessagePrefix="status" optionKey="label" optionValue="label"
                                  value="${params?.risk}"
                                  noSelection="${["": '请选择押品风险']}"/>
                    </div>
                </div>

            </div>
        %{--第二行--}%
            <div class="row">
                <div class="form-group col-sm-3">
                    <label for="district" class="col-sm-4 control-label">行政区</label>
                    <div class="col-sm-8 district">
                        <g:select class="form-control" name="city" id="district"
                                  from="${com.cindata.City.executeQuery("select distinct e.city as city from  Estate e ")}"
                                  valueMessagePrefix="status" optionKey="zoneNumber" optionValue="name"
                                  value="${params?.city}"
                                  noSelection="${["-1": '请选择城市']}"/>
                    </div>
                </div>
                <div class="form-group col-sm-5">
                    <label for="district" class="col-sm-3 control-label">贷款余额范围</label>
                    <div class="col-sm-7  input-group">
                        <input type="text" class=" form-control "
                               placeholder="请输入下限" id="loansBalanceStart" maxlength="6"
                               value="${params?.loansBalanceStart}" name="loansBalanceStart" />
                        <span class="input-group-addon">至</span>
                        <input type="text" class="form-control " placeholder="请输入上限" maxlength="6"
                               id="loansBalanceEnd"  value="${params?.loansBalanceEnd}" name="loansBalanceEnd" />
                    </div>
                    <div class="col-sm-2 p-t-xss">
                        万元
                    </div>
                </div>
                <div class="form-group col-sm-4">
                    <label for="district" class="col-sm-3 control-label">放款时间</label>
                    <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker" style="width: 75%;">
                        <input type="text" class=" form-control " placeholder="请选择放款时间"
                               value="${params?.startDateStart}" name="startDateStart" id="startDateStart" />
                        <span class="input-group-addon">至</span>
                        <input type="text" class=" form-control " placeholder="请选择结束时间"
                               value="${params?.startDateEnd}" name="startDateEnd" id="startDateEnd" />
                    </div>
                </div>

            </div>
        %{--第三行--}%
            <div class="row">
                <div class="form-group col-sm-3">
                    <label class="col-sm-4 control-label" for="noSearch">贷款时长</label>
                    <div class="col-sm-8">
                        <g:select class="form-control" name="loansDuration" id="loansDuration"
                                  from="${com.cindata.dimension.YearLimitDimension.list()}"
                                  valueMessagePrefix="status" optionKey="label" optionValue="label"
                                  value="${params?.loansDuration}"
                                  noSelection="${["": '请选择贷款时长']}"/>
                    </div>
                </div>
                <div class="form-group col-sm-5">
                    <label  class="col-sm-3 control-label">抵押面积范围</label>
                    <div class="col-sm-7  input-group">
                        <input type="text" class=" form-control " placeholder="请输入下限" id="buildAreaStart" maxlength="6"
                               value="${params?.dynamicMortgageRateStart}" name="dynamicMortgageRateStart" />
                        <span class="input-group-addon">至</span>
                        <input type="text" class="form-control " placeholder="请输入上限" id="buildAreaEnd" maxlength="6"
                               value="${params?.dynamicMortgageRateEnd}" name="dynamicMortgageRateEnd" />
                    </div>
                    <div class="col-sm-2 p-t-xss">
                        平米
                    </div>
                </div>
                <div class="form-group col-sm-4">
                    <label for="district" class="col-sm-3 control-label">贷款到期日</label>
                    <div class="col-sm-9 input-daterange input-group p-r-n"  id="datepicker2" style="width: 75%;">
                        <input type="text" class=" form-control " placeholder="请选择贷款时间"
                               value="${params?.startDateStart}" name="startDateStart" id="endDateStart" />
                        <span class="input-group-addon">至</span>
                        <input type="text" class=" form-control " placeholder="请选择贷款时间"
                               value="${params?.startDateEnd}" name="startDateEnd" id="endDateEnd" />
                    </div>
                </div>

                %{--<div class="form-group col-sm-5">--}%
                    %{--<label  class="col-sm-3 control-label">动态抵押率范围</label>--}%
                    %{--<div class="col-sm-7  input-group">--}%
                        %{--<input type="text" class=" form-control " placeholder="请输入下限" id="dynamicMortgageRateStart"--}%
                               %{--value="${params?.dynamicMortgageRateStart}" name="dynamicMortgageRateStart" />--}%
                        %{--<span class="input-group-addon">至</span>--}%
                        %{--<input type="text" class="form-control " placeholder="请输入上限" id="dynamicMortgageRateEnd"--}%
                               %{--value="${params?.dynamicMortgageRateEnd}" name="dynamicMortgageRateEnd" />--}%
                    %{--</div>--}%
                    %{--<div class="col-sm-2">--}%
                        %{--%--}%
                    %{--</div>--}%
                %{--</div>--}%
            </div>

            </div>
        </g:form>
    </div>
    </div>
<g:javascript>
    $(function () {

        $("#resetBtn").click(function () {
            $("#fullName").val("");
        })

        $('#datepicker').datepicker({
            language: 'zh-CN'
        });
        $('#datepicker2').datepicker({
            language: 'zh-CN'
        });
        $("#datepicker").on("changeDate", function(event) {
            $("#my_hidden_input").val(
                    $("#datepicker").datepicker('getFormattedDate')
            )
        });

        // $('#esateTable').footable();

        $('.input-group.date').datepicker({ });
        $('.input-daterange').datepicker({ });

        $("#city").bind("change", function(){
            $("#district option").remove();
            $("#s2id_district span:first").html("请选择行政区");
            var city = $("#city").val()
            $("#district").append("<option value='-1' >请选择行政区</option>")
            if(city=='-1'){
                return
            }
            $.ajax({
                url: "/estate/districtList",
                type: "POST",
                data: {'city': city} ,
                success: function(result){
                    for(var i=0; i < result.districtList.length; i++){
                        $("#district").append("<option value=" + result.districtList[i].zoneNumber + ">" + result.districtList[i].name + "</option>")
                    }
                }
            });
        });
        $("#city").change();

    });
    //重置按钮
    $("#resetBtn").click(function () {
        $("#s2id_city span:first").html("请选择城市");
        $("#city").val("");
        $("#s2id_district span:first").html("请选择行政区");
        $("#district").val("");
        $("#loansAmountStart").val("");
        $("#loansAmountEnd").val("");
        $("#loansBalanceStart").val("");
        $("#loansBalanceEnd").val("");
        $("#sourceAddress").val("");
        $("#startDateEnd").val("");
        $("#startDateStart").val("");
        $("#s2id_loansDuration span:first").html("请选择贷款时长");
        $("#loansDuration").val("");
        $("#s2id_remainTime span:first").html("请选择剩余还款时长");
        $("#remainTime").val("");
        $("#s2id_risk span:first").html("请选择押品风险");
        $("#risk").val("");
        $("#endDateStart").val("");
        $("#endDateEnd").val("");
        $("#buildAreaStart").val("");
        $("#buildAreaEnd").val("");

    })
</g:javascript>

</body>
</html>
